package com.red.star.macalline.data.mappers;

import com.red.star.macalline.data.core.base.MyMapper;
import com.red.star.macalline.data.entity.CardGroup;
import com.red.star.macalline.data.entity.Group;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Xucan
 * @Description:蓄客卡与联盟组关联
 * @create 2018-03-02 17:05
 **/
public interface CardGroupMapper extends MyMapper<CardGroup> {

    List<Group> queryByStoredCardAndGroup(@Param("id") Integer id);

    @Select(value = "select * from t_card_group t where t.group_id = #{groupId}")
    public List<CardGroup> findListByGroupId(Integer groupId);

    @Select(value = "select * from t_card_group t where t.card_id = #{id}")
    public List<CardGroup> findCardGroupListByid(Integer id);

    /**
     * 已经添加到蓄客卡的联盟组
     *
     * @param mallCode
     * @return
     */
    List<Group> findAddGroupList(String mallCode);


    List<Group> findByGroupId(@Param("id") Integer id, @Param("mallCode") String mallCode);

    public List<CardGroup> findCardGroupByIds(List<Integer> ids);

    CardGroup findLastByGroupId(@Param("groupId") Integer groupId);
}
